'use strict';

const Controller = require('egg').Controller;

class LearnController extends Controller {

  async getCaseInfo() {
    const result = await this.ctx.curl('106.15.191.76/case/info', {
      method: 'POST',
      contentType: 'json',
      data: {
        id: this.ctx.request.query.id,
      },
      dataType: 'json',
    });

    this.ctx.body = result.data;
    this.ctx.status = 200;
  }

  async getCase() {
    const result = await this.ctx.curl('106.15.191.76/case/search', {
      method: 'POST',
      contentType: 'json',
      data: {
        keyword: this.ctx.request.body.keyword,
      },
      dataType: 'json',
    });
    this.ctx.body = result.data;
    this.ctx.status = 200;
  }
}

module.exports = LearnController;
